<?php
/**
 * Created by PhpStorm.
 * User: pc
 * Date: 2024/3/18
 * Time: 17:04
 */

namespace app\common\service;


use yii\console\ErrorHandler;

class CustomErrorHandler extends ErrorHandler
{
    public function renderException($exception)
    {
        if(\Yii::$app->controller && \Yii::$app->controller->id == 'bg'){
            // 处理异常
            $run_obj = new Running(\Yii::$app->controller->action->id);
            $run_obj->runEnd();
        }

        // 返回适当的响应
        return parent::renderException($exception);
    }
}